From: Florian Müllner Date: Mon, 23 Sep 2019 11:46:05 +0000 (+0200) Subject: shell-util: Handle NULL from meta_window_get_image() X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~811^2^2~22 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=60cab56f86312e0ced2371f16c1fc1a7c8a0b406;p=gnome-shell.git shell-util: Handle NULL from meta_window_get_image() Until commit 506b75fc7f3 we got away with not handling a NULL return value, as cairo_surface_destroy() deals with a NULL surface; the same isn't true for get_width/get_height, so guard to code in question to prevent a crash. https://gitlab.gnome.org/GNOME/gnome-shell/issues/1678 --- diff --git a/src/shell-util.c b/src/shell-util.c index e94f3c364..c22dd1c6e 100644 --- a/src/shell-util.c +++ b/src/shell-util.c @@ -419,7 +419,7 @@ canvas_draw_cb (ClutterContent *content, * @window_actor: a #MetaWindowActor * @window_rect: a #MetaRectangle * - * Returns: (transfer full): a new #ClutterContent + * Returns: (transfer full) (nullable): a new #ClutterContent */ ClutterContent * shell_util_get_content_for_window_actor (MetaWindowActor *window_actor, @@ -439,6 +439,9 @@ shell_util_get_content_for_window_actor (MetaWindowActor *window_actor, surface = meta_window_actor_get_image (window_actor, &clip); + if (!surface) + return NULL; + content = clutter_canvas_new (); clutter_canvas_set_size (CLUTTER_CANVAS (content), cairo_image_surface_get_width (surface),